﻿@using Model.Admin;
@using Xproject.Util;
@{
    string Domain = CommonHelper.GetAppSettings("Domin");
    Layout = "~/Views/Shared/_JSlayout.cshtml";
}
@model AdminUser
<div class="gray-bg">
    <div class="  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>@ViewBag.Title</h5>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="AdminUserForm" action="~/System/EditAdminUser" method="post">

                            <div class="form-group">
                                <label class="col-sm-3 control-label">用户名：</label>
                                <div class="col-sm-8">
                                    <input id="UserName" name="UserName" class="form-control" type="text" required min="4" value="@(Model!=null?Model.UserName:"")">
                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">手机：</label>
                                <div class="col-sm-8">
                                    <input id="Mobile" name="Mobile" class="form-control" type="number" aria-required="true" aria-invalid="false" class="valid" value="@(Model!=null?Model.Mobile:"")" required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">邮箱：</label>
                                <div class="col-sm-8">
                                    <input id="Email" name="Email" class="form-control" type="email" aria-required="true" aria-invalid="false" class="valid" value="@(Model!=null?Model.Email:"")" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">登录密码：</label>
                                <div class="col-sm-8">
                                    <input type="password" class="form-control" name="Password" id="Password" placeholder="请输入密码" required value="@(Model!=null?Model.Password:"")" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">确认密码：</label>
                                <div class="col-sm-8">
                                    <input type="password" class="form-control" name="ComfirmPassword" id="ComfirmPassword" placeholder="请输入密码" required value="@(Model!=null?Model.Password:"")" />
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <div class="checkbox">
                                        <label>
                                            @if (Model != null)
                                            {
                                                <input type="checkbox" @(Model.Enable == 1 ? "checked" : "") class="checkbox" id="Enable" name="Enable">@("启用")
                                            }
                                            else
                                            {
                                                <input type="checkbox" class="checkbox" id="Enable" name="Enable">@("启用")
                                            }
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    @if (Model != null)
                                    {
                                        <input type="hidden" name="ID" value="@Model.ID" />
                                    }
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->

<script type="text/javascript">
    $(document).ready(function () {
        var optionsNew = {
            beforeSubmit: function () {
                //layer.open({ type: 2, time: 2 });
                layer.load(1, { shade: [0.1, '#000'], time: 2000 });
            },
            success: function (data) {
                if (data.Success == true) {
                    layer.alert('编辑成功', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                } else {
                    layer.alert(data.Data, { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                }
            },
            error: function () {
                alert(JSON.stringify(data));
            },
            type: "post",
            clearForm: false,
            timeout: 100000
        };

        $("#AdminUserForm").submit(function () {
            $("#AdminUserForm").ajaxSubmit(optionsNew);// type="button"
            return false;
        });
    });


</script>


